﻿
using System;
using System.Data;
using System.Text.RegularExpressions;
using System.Diagnostics;
using MySql.Data.MySqlClient;

namespace Common
{
	/// <summary>
	/// Description of MySqlPageUtil.
	/// </summary>
	public class MySqlPageUtil
	{
		public const int PAGE_SIZE=14;
		private MySqlPageUtil()
		{
		}
		//每页默认记录条数PAGE_SIZE
		public static DataSet query(string sql,int curPageIndex)
		{
			return query(sql,curPageIndex,PAGE_SIZE);
		}
		//使用MySQL的分页语句进行分页
		//curPageIndex，当前页，页码是从1开始
		public static DataSet query(string sql,int curPageIndex,int pageSize)
		{
			sql+=String.Format(" limit {0:d},{1:d}",pageSize*(curPageIndex-1),pageSize);
			return MySqlDBUtil.ExecuteQuery(sql);
		}
		
	}
}
